package org.codingeasy.streamrecord.core.support;

import org.aopalliance.aop.Advice;
import org.codingeasy.streamrecord.core.*;
import org.codingeasy.streamrecord.core.annotation.Record;
import org.codingeasy.streamrecord.core.matedata.RecordDefinition;
import org.codingeasy.streamrecord.core.processor.RecordPostProcessor;
import org.codingeasy.streamrecord.core.processor.ProcessorStrategy;
import org.codingeasy.streamrecord.core.processor.TemplateResolve;
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;

import java.lang.reflect.Method;
import java.util.concurrent.Executor;

/**
 * 用于生成对record处理的spring aop拦截链
 * @author : KangNing Hu
 */
public class RecordPointcutAdvisor extends StaticMethodMatcherPointcutAdvisor  {

  private final RecordContext recordContext;


  public RecordPointcutAdvisor(RecordContext  recordContext) {
    this.recordContext = recordContext;
  }


  @Override
  public Advice getAdvice() {
    return recordContext;
  }

  @Override
  public boolean isPerInstance() {
    return true;
  }


  @Override
  public boolean matches(Method method, Class<?> targetClass) {
    return method.isAnnotationPresent(Record.class);
  }
}
